package cn.com.shopec.erp.purchase.trigger;

import java.util.Map;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import cn.com.shopec.erp.common.utils.DateUtil;
import cn.com.shopec.erp.financing.service.ISupplierSettlementService;
/**
 * 购销结算（供应商结算定时任务）
 * @author Administrator
 *
 */
@Service
public class PurchaseOfAccountTrriger {
		
	@Resource
	private ISupplierSettlementService supplierSettlementService;
	
	private Logger logger = Logger.getLogger(PurchaseOfAccountTrriger.class);
	
	public void triggerMethod(){
		
		try {
			logger.info("==purchaseSaleOfAccountService.trigger===start");
			//Map<String, String> map = DateUtil.getLastMonthStartAndEnd();  //上一个月的结算
			//Map<String, String> map = DateUtil.getStartAndEndThree(30);	 //根据30天为结算期结算
			Map<String, String> map = DateUtil.getStartAndEnd();			 //当月结算
			supplierSettlementService.createSupplierSettlement(map.get("start"), map.get("end"));
			logger.info("===purchaseSaleOfAccountService.trigger createSupplierSettlement success!");;
		} catch (Exception e) {
			logger.info("==purchaseSaleOfAccountService.trigger===execption"+e);
		}
		logger.info("==purchaseSaleOfAccountService.trigger===end");
	}
	
}

